import axios from "./axios";
import { base } from '@/conf'

export const getMyCptt = params => axios.get('/htcp/getmycptt',{params})
.then(e=>{
  e.cptts.map(item=>{
    if(item.imgname) item.url = base.imgUrl + item.imgname
    delete item.imgname
  })
  return e
})

export const getHisCptt = params => axios.get('/htcp/gethiscptt',{params})

export const getRanking = params => axios.get('/htcp/getranking',{params})

export const addcptt = data => axios.post('/htcp/addcptt',data)

export const getdelcptt = params => axios.get('/htcp/getdelcptt',{params})
.then(e=>{
  e.cptts.map(item=>{
    if(item.imgname) item.url = base.imgUrl + item.imgname
    delete item.imgname
  })
  return e
})

export const delcptt = data => axios.put('/htcp/delcptt',data)

export const recovercptt = data => axios.put('/htcp/recovercptt',data)

export const deepdelcptt = params => axios.delete('/htcp/deepdelcptt',{params})